import React, {Component} from 'react';
import './App.css';
import Utils from "./Utils";

const utils = new Utils();
class App extends Component {

  constructor(p) {
    super(p);
    this.state = {
      num: 1
    };
    this.handleAddClick = this.handleAddClick.bind(this);
  }

  handleAddClick() {
    this.setState({
      num: this.state.num + 1
    });
  }

  render() {
    return (
        <>
          <div className='App'>
            {this.state.num}
          </div>
          <div className='App'>
            {/*<button onClick={this.handleAddClick}>加一(bind)</button>*/}
            {/*<button onClick={this.handleAddClick.bind(this)}>加一(bind(this))</button>*/}
            {/*<button onClick={() => this.handleAddClick()}>加一(=>)</button>*/}
            {/*{utils.getTestArray(10000).map(i=><button onClick={this.handleAddClick}>加一(bind)</button>)}*/}
            {/*{utils.getTestArray(10000).map(i=><button onClick={this.handleAddClick.bind(this)}>加一(bind(this))</button>)}*/}
            {utils.getTestArray(10000).map(i=><button onClick={() => this.handleAddClick()}>加一{i}(=>)</button>)}
          </div>
        </>

    );
  }
}

export default App;
